<div id="spnoibat">
    <div class="spnoibat-header">
        <?php
        $sql_cl="SELECT * FROM tbl_chungloai WHERE chungloai_id = '".$cate."' LIMIT 12";
        $result_cl=mysql_query($sql_cl);
        $row_cl=mysql_fetch_array($result_cl);
        echo '<p>'.$row_cl['chungloai'].'</p>';
        ?>

    </div>
    <div class="spnoibat-content">
        <?php

        $sql="SELECT * FROM tbl_loai WHERE chungloai_id = '".$cate."'";
        $result=mysql_query($sql);
        $num=mysql_num_rows($result);
        if($num>0){
            while($row=mysql_fetch_array($result))
            {
                ?>
                <div class="sanpham">
                    <div class="danhmuc-img">
                        <a href="index.php?page=san-pham&list=loai&kind=<?php echo $row['loai_id']?>"><?php if($row['anhl']==''){echo '';}else{?><img src="uploads/<?php echo $row['anhl']?>" width="110" height="86" class="sp-img"><?php }?></a>
                    </div>
                    <div class="danhmuc-main">

                        <h3><a href="index.php?page=san-pham&list=loai&kind=<?php echo $row['loai_id']?>"><?php echo $row['loai']?></a></h3>

                    </div>
                </div>
            <?php
            }
        }else{
            $sql="SELECT * FROM tbl_sanpham WHERE chungloai_id = '".$cate."' LIMIT 12";
            $result=mysql_query($sql);
            while($row=mysql_fetch_array($result))
            {
                ?>
                <div class="sanpham">
                    <div class="spnoibat-img">
                        <a href="index.php?page=san-pham&list=chi-tiet&id=<?php echo $row['id'];?>"><img src="uploads/<?php echo $row['anhsp']?>" width="110" height="86" class="sp-img"></a>
                    </div>
                    <div class="spnoibat-main">
                        <h3><a href="index.php?page=san-pham&list=chi-tiet&id=<?php echo $row['id'];?>"><?php echo $row['sanpham']?></a></h3>
                        <p>Giá: <?php echo $row['gia']?></p>
                        <p>Giao hàng: <?php echo $row['giaohang']?></p>
                        <p>Tình trạng: <?php if($row['tinhtrang']==1){echo 'Còn hàng';}else{echo 'Hết hàng';}?></p>
                    </div>
                </div>
            <?php
            }
        }
        ?>
    </div>
</div>